<template>
  <div class="remarks-style">
    <div class="close-box" @click="store.setChildRemarksShow(false)">
      <i class="doorIcon">&#xe63d;</i>
    </div>
    <div class="remarks-style--border"></div>
    <div
      class="remarks-style-conetnt"
      :style="{ backgroundImage: `url(${publicUrls + 'free/style1/scrollBcakground1.png'})` }"
    >
      <div class="remarks-style-left">
        <div class="title">
          <div class="bg">{{ store.childTitle }}</div>
        </div>
        <scrollBox
          color="rgba(50, 43, 37, 1)"
          :scrollSrc="publicUrls + 'free/style1/pen.png'"
          v-if="Scrollheights"
          :remarks="store.childRemarks"
          :byid="100"
          :height="getScrollWComputed"
        >
          <template #solidBorder>
            <div class="solidBorder-child"></div>
          </template>
        </scrollBox>
      </div>
    </div>
    <div class="remarks-style--border"></div>
  </div>
</template> 

<script lang="ts">
export default defineComponent({
  name: 'styleOne',
});
</script>

<script setup lang="ts">
import { publicUrls } from '@/utils/minxin';
import scrollBox from '../scrollBox.vue';
import { useProjectStore } from '@/store';
import { ref, computed, defineComponent } from 'vue';

const store = useProjectStore();
let viewportHeight = window.innerHeight;
const Scrollheights = ref();
Scrollheights.value = (viewportHeight / 900) * 440;
const getScrollWComputed = computed(() => {
  if (store.isMobileType) {
    let rootNode = document.documentElement;

    // 获取计算后的样式
    let computedStyle = window.getComputedStyle(rootNode);

    // 读取字体大小（注意这里返回的可能是一个包含单位的字符串，如"16px"）
    let fontSize = computedStyle.fontSize;

    // 如果你需要一个数字值（不带单位）进行计算，你可能需要解析这个字符串
    // 例如，使用正则表达式或split()方法去除单位，并将结果转换为数字
    let fontSizeNumber = parseFloat(fontSize.replace(/[^0-9.-]/g, ''));
    // let heights = (fontSizeNumber / 144)
    let heights = (fontSizeNumber / 144) * 440;
    return heights;
  } else {
    return Scrollheights.value;
  }
});
</script>   

<style scoped lang="less">
.remarks-style {
  display: flex;
  flex-direction: column;
  position: relative;
  width: 100%;
  max-width: 1200px;
  height: 624px;
  background: transparent;

  transform: translateZ(0px);
}
.remarks-style-conetnt {
  display: flex;
  width: 100%;
  height: 100%;
  //   background: #fff;
  background-repeat: repeat;
  background-size: auto 100%;
  background-color: #fef3df;
  padding-top: 30px;
}
.title {
  width: auto;
  height: 79px;
  border: 1px solid #fef3df;
  padding: 6px;
  margin-bottom: 30px;
  .bg {
    width: 100%;
    height: 100%;
    background: #fef3df;
    box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.25);
    padding: 18px 78px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #322b25;
    text-align: center;
    font-family: 'SourceHanSerifCN-Bold';
    font-size: 24px;
  }
}
.remarks-style-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  padding-left: 92px;
  padding-right: 62px;
  height: 100%;
}
.solidBorder-child {
  width: 4px;
  height: 100%;
  border-radius: 1.055px;
  opacity: 0.1;
  background: #6c5c4f;
  box-sizing: border-box;
  border-left: 2px solid rgba(81, 81, 81, 1);
  border-right: 2px solid rgba(81, 81, 81, 1);
}
.remarks-style--border {
  width: 100%;
  height: 8px;
  background: linear-gradient(180deg, #dbd7cb 26.67%, #a28f6e 83.94%);
  box-shadow: 0px 4px 4px 0px rgba(142, 105, 57, 0.25);
}
.close-box {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 60px;
  right: 58px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.18);
  .doorIcon {
    font-size: 24px;
    color: #fff;
  }
  z-index: 30;
}
</style>
